package com.vcredit.creditcat.web;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import com.vcredit.creditcat.model.RecommendCard;
import com.vcredit.creditcat.vo.RecommendCardVo;
import com.vcredit.creditcat.service.RecommendCardService;
import com.vcredit.creditcat.framework.pagination.Page;
import com.vcredit.creditcat.web.BaseController;
 /*
  * @author zhangxingong
  * @version 1.0
  * @since 1.0
 */
@RestController
@RequestMapping("/recommendCard")
public class RecommendCardController extends BaseController {
    
  @Autowired
  private RecommendCardService recommendCardService;
  
    @RequestMapping("/list")
    public ModelAndView  showPageRecommendCard(HttpServletRequest request) {
        return new ModelAndView("/recommendcard/recommendCardList");
    }  
	
	@RequestMapping("/listRecommendCard")
	public Page<RecommendCard> findByPageRecommendCard(HttpServletRequest request) {
		Page<RecommendCard> result=recommendCardService.findByPage(makeDefaultCriteria(request));
      return result;
	}
	
	@RequestMapping("/saveRecommendCard")
	public String saveRecommendCard(@RequestBody RecommendCardVo recommendCardVo,HttpServletRequest request) {
	    recommendCardService.save(recommendCardVo);
		return SUCCESS;
	}
	   
    @RequestMapping("/updateRecommendCard")
    public String recommendCardUpdate(@RequestBody RecommendCard recommendCard,HttpServletRequest request) {
        recommendCardService.update(recommendCard);
        return SUCCESS;
    }
    
    @RequestMapping("/removeRecommendCard")
    public String removeRecommendCard(@RequestParam("ids") String ids ,HttpServletRequest request) {
        recommendCardService.removeRecommendCard(ids);
        return SUCCESS;
    }	
}
